Example:The following example shows how to use an attribute classes.
import com.cete.dynamicpdf.*; import com.cete.dynamicpdf.pageelements.*; public class MyClass{ public static void main(String args[]){ // Create a PDF Document Document document = new Document(); // Specify document as a tagged PDF document.setTag(new TagOptions()); // Create a page and add it to the document Page page = new Page(); document.getPages().add(page); // Create a text area TextArea textArea = new TextArea("This is the " + "text of a TextArea", 100, 100, 400, 30, Font.getHelveticaBoldOblique(), 18); // Create a structue element StructureElement structureElement = new StructureElement(TagType.getParagraph(), true); // Create an attribute class AttributeClass attributeClass = new AttributeClass("MyAttribueClass"); // Create an attribute object AttributeObject attributeObject1 = new AttributeObject(AttributeOwner.LAYOUT); // Add attributes to the attribute object attributeObject1.setLineHeight(); // Sets default value to the line height attribute attributeObject1.setHeight(30); // Sets specified value to the height attribute // Add attribute object to the attribute class attributeClass.getAttributeObjects().add(attributeObject1); // Create an attribute object AttributeObject attributeObject2 = new AttributeObject(AttributeOwner.HTML_3_20); // Add attributes to the attribute object attributeObject2.setPlacement(); // Sets default value to the line height attribute attributeObject2.setSpaceBefore(); // Sets default value to the space after attribute // Add attribute object to the attribute class attributeClass.getAttributeObjects().add(attributeObject2); // Add attribute class to the structure element structureElement.getClasses().add(attributeClass); // Tag the text area with the structure element textArea.setTag(structureElement); // Add the text area to the page page.getElements().add(textArea); //Save the PDF document.draw("[PhysicalPath]/MyDocument.pdf" ); } }